<?php
require_once "./includes/parselang.php";
require_once "./includes/dogtagsimg1.php";
require_once "./includes/dogtagstitles.php";
?>

<script type="text/javascript">
$(document).ready(function(){$('#dogtags-equip').click(function ()
{
	var notice="<?=$lang['dogtagsSaved']?>";
	$("#receipt-container").append($("<li  id='savedogtag' class='receipt checkbox' style='opacity: 0; top: -32px;'>").text(notice));
	$("#savedogtag").animate({opacity: '1', top: '0px'}, "slow");

});});
var elem = document.getElementById('savedogtag');
setTimeout(function ()
{
	$("#savedogtag").animate({opacity: '0', top: '-32px'}, "slow");
	}, 2500);
$("#savedogtag").remove();
</script>

<script type="text/javascript">
function savedogtags(id) 
{
    $.ajax({
		type: 'POST',
        url: 'savedogtags.php',
		data: "id="+id,
        success: function(data)
		{
           $('.DogtagsResult').html(data);
        },
		error:  function(xhr, str){
            alert('Возникла ошибка: ' + xhr.responseCode);
        }
    });
}
</script>

<?php
$dsnm = $_POST['dsnm'];
$id = $_POST['id'];
$type = substr($id, 0, 3);

if($type == 'dtb')
{
	$dtb = substr($id, 3, 3);
	$dta = $_POST['dta'];
}

if($type == 'dta')
{
	$dta = substr($id, 3, 3);
	$dtb = $_POST['dtb'];
}

$status = $_POST['status'];

echo "<aside class='span4 dogtag-aside sticky-scroll fixed' style='top: 275px; margin-left: 688px;'>\n";
echo "<div id='dogtags-equipped-box' class='box equipped'>\n";

if($type == 'dtb')
{
	echo "<div class='box-content selected-dog-tags basic-active'>\n";
}
else
{
	echo "<div class='box-content selected-dog-tags advanced-active'>\n";
}

echo "<div class='dogtags dogtags-chain horizontal' style='margin-left:7px'>\n";
drawimg("dtb"."$dtb");
drawimg("dta"."$dta");
echo "<div class='dog-tag-name-overlay'><p>".$dsnm."</p></div></div>";
if ($status == 'unlocked')
{
	?><button id="dogtags-equip" class="btn btn-small btn-primary btn-equip" onclick="savedogtags('<?=$id?>'); return false;"><?=$lang['EquipDogTags']?></button><?php
}
else
{
	echo "<button class='btn btn-small btn-primary btn-equip donotequip'>".$lang['EquipDogTags']."</button>";
}
echo "</form>\n";
echo "</div>\n";
if($type == 'dtb')
{
	drawtitle("dtb"."$dtb", $lang);
}
else
{
	drawtitle("dta"."$dta", $lang);
}
echo "</div>\n";
echo "</aside>\n";
echo "</div>\n";
?>
